import React, { PureComponent } from 'react';
import Script from 'react-load-script';
// require("./themes/default/default.less");
import Kindeditor from '@/assets/kindeditor/kindeditor-all-min.js';
import styles from '@/assets/kindeditor/themes/default/default.less';
class Kindeditor1 extends PureComponent {
    /**
     * 前置函数
     */
    componentDidMount(){
        setTimeout(() => {
            // console.log('Kindeditor',Kindeditor.ready);
        }, 500);
        console.log('KindEditor',KindEditor)
        KindEditor.ready(function(K) {
            K.create('#ke_demo', {
                allowFileManager : true
            });
        });
    }
    handleScriptCreate() {
        console.log('handleScriptCreate');
      }
       
      handleScriptError() {
        console.log('handleScriptError');
      }
       
      handleScriptLoad() {
        console.log('handleScriptLoad');
        console.log('KindEditor',KindEditor)
        KindEditor.ready(function(K) {
            K.create('#ke_demo', {
                allowFileManager : true
            });
        });
      }
    render(){
        return (
                <>
                {/* <Script
                url="http://kindeditor.net/ke4/kindeditor-all-min.js?t=20160331.js"
                onCreate={this.handleScriptCreate.bind(this)}
                onError={this.handleScriptError.bind(this)}
                onLoad={this.handleScriptLoad.bind(this)}
                /> */}
                {/* <link href="./themes/default/default.css" rel="stylesheet" /> */}
                <textarea id="ke_demo" name="content" rows="20" cols="100" style={{width:"95%",height:200}} 
                    value={this.props.value}
                    onChange={this.props.onChange}
                    ></textarea>
                </>
            )
    }
}

export default Kindeditor1;